<template>
    <ul>
        <li v-for="item in lists" :key="item.id" >{{item.name}}
            <button @click="del(item.id)">删除</button>
        </li>
        
    </ul>
</template>
<script setup>
import {onMounted ,ref} from 'vue'
import emitter from '../plugins/Bus'

let lists = ref([])


// let refFn = ()
onMounted(()=>{
    emitter.on('fn',(e)=>{
        console.log(lists,"rrr");
        console.log(e,"trtrtr");
        lists.value.push(e)
        console.log(lists,4874848);
    })
})
const del = (id)=>{
lists.value = lists.value.filter(p=>p.id!==id)
}








</script>